#include "download.h"
#include "bar.h"

typedef void (*callback_t) (double, double);

const double ToTAL = 1024.0;

double speed = 1.0;

void download(callback_t cb)
{
    double cur = 0;
    while(cur <= ToTAL)
    {
        cb(ToTAL, cur);
        usleep(10000);// 充当下载时间
        cur += speed;
    }
    printf("\ndownload %.1lfMB done\n", ToTAL);
}
